package org.pf.base.pfBlocks
{
	import org.pf.base.PFBlock;
	import org.pf.interfaces.IPFPrince;
	import org.pf.interfaces.IPFState;
	import org.pf.PFPrince;
	import org.pf.interfaces.IPFController;
	
	/**
	 * ...
	 * @author zeksa'
	 */
	public class PFState extends PFBlock implements IPFState
	{
		public function PFState(name:String)
		{
			super(PFBlock.STATE_BLOCK);
			_name = name;
		}
		
		override public function activate():void
		{
		}
		
		override public function deactivate():void
		{
		}
		
		public function registerController(ControllerClass:Class):void
		{
			var controller:PFController = new ControllerClass();
			_prince.get_SystemPool().add(controller);
			controller.activate();
		}
		
		public function retrieveController(name:String):IPFController
		{
			return _prince.get_SystemPool().extract(PFBlock.CONTROLLER_BLOCK, name) as PFController;
		}
		
		public function unregisterController(controllerName:String):void
		{
			("unregistering started");
			_prince.get_SystemPool().extract(PFBlock.CONTROLLER_BLOCK, controllerName).deactivate();
			_prince.get_SystemPool().extract(PFBlock.CONTROLLER_BLOCK, controllerName).safe_deactivate();
			_prince.get_SystemPool().destroy(PFBlock.CONTROLLER_BLOCK, controllerName);
		}
	}

}